<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<title>VIP管理</title>
		<link rel="stylesheet" type="text/css" href="${ctx }/styles/displaytag.css" />
		<script type="text/javascript">
			function editVipService(){
				art.dialog.open(
					ctx + "/editVipService.html", {
						title: "添加VIP服务",
						width:"500px", 
						height:"360px",
						lock: true
					}
				);
			}
			
			function deleteVipService(id){
				var url = ctx + "/deleteVipService.html?ajax=true";
				var param = "&id=" + id;
				var sf = function (msg) {
					if (msg == 1 || msg == "1" || msg == "\"1\"") {
						art.dialog.tips("<label class='success'>删除成功！</label>", 1);
						window.location.reload();
						return true;
					}else{
						art.dialog.tips("<label class='error'>删除失败，请刷新页面重试！</label>", 1);
						return false;
					}
				};
				ajax(url, param, sf);
			};
			
			function deleteItem(id){
				art.dialog({
				    content: '您确定要删除该条VIP服务吗？',
				    ok: function () {
				        return deleteVipService(id);
				    },
				    cancel: true,
					lock: true
				});
			}
		</script>
	</head>
	<body>
		<div class="container_16">
			<div class="grid_16">
				<div class="content_top">
					<span>VIP管理</span>
				</div>
				<div class="content_bottom">
					<div style="padding: 30px;">
						<c:if test="${'ROLE_ADVISER' eq currentRole.name }">
							<div style="margin-bottom: 10px;">
								<a href="javascript:void(0)" title="添加VIP服务" onclick="editVipService()"><img alt="添加VIP服务" src="${ctx }/images/add_vip_service.jpg"></a>
							</div>
						</c:if>
						<display:table id="vipService" name="pageBean" pagesize="10" class="display_table" requestURI="">
							<display:column title="序号" value="${(pageBean.pageNumber - 1) * pageBean.objectsPerPage + vipService_rowNum }" style="width: 5%"/>
						 	<display:column title="专案号"  property="vipServiceId" style="width: 15%"/> 	
						 	<c:choose>
						 		<c:when test="${'ROLE_ADVISER' eq currentRole.name or 'ROLE_EDITOR_IN_CHIEF' eq currentRole.name }">
						 			<display:column title="学生姓名" property="vip.nickname" style="width: 15%"/>
						 		</c:when>
						 		<c:when test="${'ROLE_USER' eq currentRole.name }">
						 			<display:column title="留学顾问" property="adviser.nickname" style="width: 15%"/>
						 		</c:when>
						 	</c:choose>
						 	<display:column title="当前阶段" property="planStageName" style="width: 20%"/>
						 	<display:column title="本阶段截至日期" property="planStageDate" format="{0,date,yyyy-MM-dd}" style="width: 15%"/>
						 	<c:choose>
						 		<c:when test="${'ROLE_ADVISER' eq currentRole.name or 'ROLE_USER' eq currentRole.name }">
						    		<display:column title="专业顾问" property="editor.nickname" style="width: 15%"/>
						 		</c:when>
						 		<c:when test="${'ROLE_EDITOR_IN_CHIEF' eq currentRole.name }">
						 			<display:column title="留学顾问" property="adviser.nickname" style="width: 15%"/>
						 		</c:when>
						 	</c:choose>  	
						 	<display:column title="操作" style="width: 15%">
						 		<a href="${ctx }/initVipServiceInfo.html?id=${vipService.id }">详情</a>
								<c:if test="${'ROLE_USER' ne currentRole.name }">
									<a href="javascript:void(0)" onclick="deleteItem(${vipService.id })">删除</a>
								</c:if>
						 	</display:column>
						 </display:table>
					</div>
				</div>
			</div>		
		</div>
	</body>
</html>		